package com.firstgroup.controller;

import com.firstgroup.domain.Evaluate;
import com.firstgroup.domain.Interviewers;
import com.firstgroup.repository.EvaluateRepository;
import com.firstgroup.service.Impl.EvaluateServiceImpl;
import com.firstgroup.service.Impl.InterViewServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "面试官打分类")
@RestController
public class EvaluateController {
    @Autowired
    EvaluateServiceImpl evaluateServiceImpl;
    @Autowired
    InterViewServiceImpl interViewServiceImpl;

    /**
     * 一面打分
     * @param userid
     * @param interviewerId
     * @param heart
     * @param communicate
     * @param study
     * @param strain
     * @param compression
     * @param attitude
     * @param understand
     * @return
     */
    @RequestMapping(value = "/addCountsOne",method = RequestMethod.POST)
    @ApiOperation(value = "一面打分功能")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "用户id",name = "userid",required = true,type = "int"),
            @ApiImplicitParam(value = "面试者id",name = "interviewerId",required = true,type = "int"),
            @ApiImplicitParam(value = "心理素质",name = "heart",required = true,type = "int"),
            @ApiImplicitParam(value = "沟通能力",name = "communicate",required = true,type = "int"),
            @ApiImplicitParam(value = "自学能力",name = "study",required = true,type = "int"),
            @ApiImplicitParam(value = "应变能力",name = "strain",required = true,type = "int"),
            @ApiImplicitParam(value = "抗压能力",name = "compression",required = true,type = "int"),
            @ApiImplicitParam(value = "态度",name = "attitude",required = true,type = "int"),
            @ApiImplicitParam(value = "对小组了解情况",name = "understand",required = true,type = "int"),


    })
    public Evaluate addCountsOne(int userid,int interviewerId,int heart,int communicate,
                              int study,int strain,int compression,int attitude,int understand){
    Evaluate evaluate=evaluateServiceImpl.addCountOne(userid, interviewerId, heart, communicate,
                    study, strain, compression, attitude, understand);
        return evaluate;


    }


    /**
     * 二面打分
     * @param userid
     * @param interviewerId
     * @param heart
     * @param communicate
     * @param study
     * @param strain
     * @param compression
     * @param attitude
     * @param understand
     * @return
     */
    @RequestMapping(value = "/addCountsTwo",method = RequestMethod.POST)
    @ApiOperation(value = "二面打分功能")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "用户id",name = "userid",required = true,type = "int"),
            @ApiImplicitParam(value = "面试者id",name = "interviewerId",required = true,type = "int"),
            @ApiImplicitParam(value = "心理素质",name = "heart",required = true,type = "int"),
            @ApiImplicitParam(value = "沟通能力",name = "communicate",required = true,type = "int"),
            @ApiImplicitParam(value = "自学能力",name = "study",required = true,type = "int"),
            @ApiImplicitParam(value = "应变能力",name = "strain",required = true,type = "int"),
            @ApiImplicitParam(value = "抗压能力",name = "compression",required = true,type = "int"),
            @ApiImplicitParam(value = "态度",name = "attitude",required = true,type = "int"),
            @ApiImplicitParam(value = "对小组了解情况",name = "understand",required = true,type = "int"),


    })
    public Evaluate addCountsTwo(int userid,int interviewerId,int heart,int communicate,
                                 int study,int strain,int compression,int attitude,int understand){
        Evaluate evaluate=evaluateServiceImpl.addCountTwo(userid, interviewerId, heart, communicate,
                study, strain, compression, attitude, understand);
        return evaluate;

    }

//    @RequestMapping(value = "/findByAInterviewerId",method = RequestMethod.GET)
//    @ApiOperation(value = "遍历面试者分数")
//    @ApiImplicitParams({
//            @ApiImplicitParam(value = "面试者id",name = "interviewerId",required = true,type = "int")
//
//    })
//    public List<Evaluate> findByAInterviewerId(int interviewerId){
//     List<Evaluate> evaluate= evaluateServiceImpl.findByInterviewerId(interviewerId);
//        return evaluate;
//    }

    @RequestMapping(value = "/find",method = RequestMethod.GET)
    @ApiOperation(value = "遍历该面试者平均分数")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "面试者id",name = "interviewerId",required = true,type = "int"),
            @ApiImplicitParam(value = "面试状态",name = "value",required = true,type = "String")

    })
    public List<Object[]> find(int interviewerId,String value){
     List<Object[]> list=  evaluateServiceImpl.find(interviewerId,value);
        return list;
    }



    @RequestMapping(value = "/findAccountOne",method = RequestMethod.GET)
    @ApiOperation(value = "遍历面试者分数")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "面试者id",name = "interviewerId",required = true,type = "int"),
            @ApiImplicitParam(value = "面试状态",name = "value",required = true,type = "String")

    })
    public List<Evaluate> findAccount(int interviewerId,String value){
        List<Evaluate> evaluate= evaluateServiceImpl.findAccount(interviewerId, value);
        return evaluate;
    }


}
